﻿@{
    ViewBag.Title = "Register";
    Layout = "~/Views/Shared/_LayoutPageAll.cshtml";
}
@*页面中心内容*@
<div class="content clearfix">
    @*局部导航*@
    <div class="breadcrumbs">
        <h2 class="element-invisible">You are here</h2><div class="breadcrumb"><a href="/">返回首页</a>» 用户账号注册</div>
    </div>
    @*标签页*@
    <div id="content" class="column content-inner">
        <div class="section">
            <h1 class="title" id="page-title">User account</h1>
            <h2 class="element-invisible">Primary tabs</h2>
            <ul class="tabs primary">
                <li class="active"><a href="/Register/Register" class="active">新建账号<span class="element-invisible">(active tab)</span></a></li>
                <li><a href="/Login/Usert">登录</a></li>

            </ul>
        </div>
        @*注册块*@
        <div class="region region-content">
            <div id="block-system-main" class="block block-system">
                <div class="content">
                    <form class="user-info-from-cookie" enctype="multipart/form-data" action="注册.html" method="post" id="user-register-form" accept-charset="UTF-8">
                        <div>
                            <div id="edit-account" class="form-wrapper">
                                <div class="form-item form-type-textfield form-item-name">
                                    <label for="edit-name">账户 <span class="form-required" title="This field is required.">*</span></label>
                                    <input class="username form-text required" type="text" id="Uname" name="name" placeholder="请输入手机号码登陆" value="" size="60" maxlength="60" />

                                </div>

                                <div class="form-item form-type-textfield form-item-mail">
                                    <label for="edit-mail">密码 <span class="form-required" title="This field is required.">*</span></label>
                                    <input type="password" id="Upwd" name="Upwd" value="" size="60" maxlength="254" class="form-text required" />
                                </div>




                                <input type="hidden" name="timezone" value="Asia/Bangkok" />
                            </div><input type="hidden" name="form_build_id" value="form-j3mwM1q78HNc06ksNWA3jfMwWQyyKV0wTCYKQQPBLs4" />
                            <input type="hidden" name="form_id" value="user_register_form" />
                            <div class="form-actions form-wrapper" id="edit-actions"><input type="button" id="edit-submit" name="op" value="登陆" onclick="fun()" class="form-submit" /></div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<link href="~/scriptstyle/css/base.css" rel="stylesheet" />
<script src="~/js/jquery-1.8.2.js"></script>
<script src="~/scriptstyle/dsdialog.js"></script>


<script type="text/javascript">
    function fun() {
        var Uname = $("#Uname").val();
        var Upwd = $("#Upwd").val();
      
        $.ajax({
            url: "http://localhost:19451/api/Home/Getlogin",
            type: "Get",
            data: {
                account: Uname,
                pwd: Upwd,
            },

            success: function (data) {

                if (data == 1) {
                    ds.dialog({
                        title: '消息提示',
                        content: '管理员登陆成功！',        
                        icon:"<img src='~/images/success.png' />" ,

                    });
                    location.href = '/Home/tcp?UserID=' + data + '';

                }
                else if (data > 1) {
                    ds.dialog({
                        title: '消息提示',
                        content: '登陆成功！',
                        icon: "success.png",
                        timeout: 2,
                    });
                    location.href = '/Home/Index?UserID=' + data + '';
                }
                else {
                    ds.dialog({
                        title: '消息提示',
                        content: '账户或密码错误',
                        onyes: true,
                        icon: "info.png",

                    });
                }
            }
        })
    }


</script>



